package com.study.mq;

import com.study.model.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: chenhs
 * @date: Created in 11:10 2019/12/2
 **/
@Component
public class MessageProducer {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void sendMessage(User user) {
        amqpTemplate.convertAndSend(RabbitConfig.DIRECT_ROUTING_KEY_sendqueue, user);
    }

}
